/**
 * bus静态类
 */
class EventBus {
  static bus = window.xVueWeb.app.config.globalProperties.$adoPremiseEvtBus;

  static $emit(evtKey, value) {
    this.clear(evtKey);
    this.bus.$emit(evtKey, value);
  }

  static $on(evtKey, callback) {
    this.bus.$on(evtKey, value => callback(value));
  }

  static $once(evtKey, callback) {
    this.bus.$once(evtKey, value => callback(value));
  }

  static $off(evtKey) {
    this.bus.$off(evtKey);
  }

  static clear(evtKey) {
    if (this.bus.clear) {
      this.bus.clear(evtKey);
    }
  }
}
export default EventBus;
